﻿using UnityEngine;
using System.Collections;

namespace Room
{
    public class RCAIChariotFactoryComplete : RCAIChariotFactoryBase
    {
        GameObject obj;
        protected override void OnEnter()
        {
            if (controller.dictData.IsField==1)
            {
                ShowEffect();
            }
            controller.SwitchState((int)UnionChariotFactoryState.Actived);
        }

        void ShowEffect()
        {
            if (obj == null)
            {
                obj = controller.Spawn(RoomUnionFight.PROJECTILE_BEHIT_MAKE);
                obj.transform.localPosition = controller.sceneObj.transform.GetChild(0).localPosition;
                obj.SetActive(true);
            }
            else
            {
                obj.SetActive(true);
            }
        }

        protected override void OnLeave()
        {
            if(obj!=null)
            {
                controller.Unspawn(obj);
            }
        }

    }
}